from selenium import webdriver
from selenium.webdriver.common.by import By
import requests
dr =webdriver.Firefox()
dr.get('http://stu000339/dbshop/public/')

# 1.定位元素，获取元素的scr属性值
el=dr.find_element(By.XPATH,'//img')
print(el)
url=el.get_attribute('src')
print(url)
# # 2.利用get请求访问图片，获取http相应内容
# resp=requests.get(url)
# t=resp.content
#
# # 3.新建一个图片文件，把相应内容放到图片文件中
# f = open('../img/1.png','wb+')
# f.write(t)
# f.close()

